import logging
import config_default
import os
import json


data_file='data.json'

def read_data():
	try:
		with open(os.path.join(config_default.configs['workspace'],data_file), 'r') as f:
			json_str = f.read()
			return json.loads(json_str) if json_str else {}
	except FileNotFoundError as e:
		logging.error(e)
	return {}

def write_data(data):
	with open(os.path.join(config_default.configs['workspace'],data_file), 'w') as f:
		f.write(json.dumps(data))
